import { createRouter, createWebHashHistory } from "vue-router";
import Layout from "../views/Layout/Index.vue";
import Home from "../views/Home/Home.vue";

const routes = [
  {
    path: "/",
    redirect: "/layout",
  },
  {
    path: "/layout",
    redirect: "/home",
    name: "layout",
    component: Layout,
    children: [
      {
        path: "/home",
        name: "home",
        component: Home,
      },
      // 产品
      {
        path: "/product/list",
        name: "product-list",
        component: () => import("../views/Product/List.vue"),
      },
      {
        path: "/product/category",
        name: "product-category",
        component: () => import("../views/Product/Category.vue"),
      },
      // 订单
      {
        path: "/order/list",
        name: "order-list",
        component: () => import("../views/Order/List.vue"),
      },
      {
        path: "/order/collect",
        name: "order-collect",
        component: () => import("../views/Order/Collect.vue"),
      },
      // 广告
      {
        path: "/advertisement/list",
        name: "advertisement-list",
        component: () => import("../views/Advertisement/List.vue"),
      },
    ],
  },
  {
    path: "/login",
    name: "login",
    component: () => import("../views/Login/Index.vue"),
  },
];

export const router = createRouter({
  routes,
  history: createWebHashHistory(),
});
